﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SingletonPattern
{
    /// <summary>
    /// 登记式/静态内部类
    /// </summary>
    public class Singleton4
    {
        public static class SingletonHolder
        {
            private static Singleton4 instance = new Singleton4();
            public static Singleton4 GetInstance()
            {
                return instance;
            }
        }

        private Singleton4() { }

        public static Singleton4 GetInstance()
        {
            return SingletonHolder.GetInstance();
        }
    }
}
